import { MgrDef } from "../const/ModelConst";
import MD from "../MD";
import DesignScene from "../scene/DesignScene";
import EntityMgr from "./EntityMgr";

export default class SceneMgr implements IMgr {


    private _ds:DesignScene;
    
    get ds() {
        return this._ds;
    }

    startUp(): void {
        this.createDesignScene();
    }

    createDesignScene():void {
        this._ds = new DesignScene();
    }

     /** 挂载主场景 */
     mountedMainScene():void {

        MD.Log('mounted model design scene');

        MD.container.appendChild(this._ds.render.domElement);
        MD.container.appendChild(this._ds.css2dRender.domElement);
    }

    clearALLMesh():void{
        let mgr = MD.mgr[MgrDef.ENTITY_MGR] as EntityMgr;
        let allmap = mgr.ALMap;
        for (let value of allmap.values()) {
            this.ds.scene.remove(value.mesh);
        }
    }

    /** 视角复位 */
    resetCameraPosition():void {
        this._ds.camera.up.set(0,1,0);
        this._ds.camera.position.set(3000, 6000, 3000);
        this._ds.camera.lookAt(0,0,0);
    }

    dispose(): void {
        
    }
}